package com.bicon.botu.file.upload.common;
import java.io.File;
import java.util.List;

/**
 * @Author 李双喜
 * @Date 2017/12/13 10:17
 */
public class ProcessFlvImg {
    // ffmpeg.exe的目录
    //public String ffmpegpath = "D:\\video\\FFmpeg\\bin\\ffmpeg.exe";

    public boolean processImg(String path) {

        File fi = new File(path);

        List commend = new java.util.ArrayList();
        commend.add("/usr/local/ffmpeg/ffmpeg/install/dir/bin/ffmpeg");
        commend.add("-i");
        commend.add(path);
        commend.add("-y");
        commend.add("-f");
        commend.add("image2");
        commend.add("-ss");
        commend.add("38");
        commend.add("-t");
        commend.add("0.001");
        commend.add("-s");
        commend.add("320x240");
        commend.add(fi.getPath() + ".jpg");

        try {
            ProcessBuilder builder = new ProcessBuilder();
            builder.command(commend);
            builder.start();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}
